# Makefile for ohai
# Copyright 2008 Cian Synnott.
# $Id: Makefile.in 30 2009-12-04 03:45:37Z cian $

prefix      = @prefix@
exec_prefix = @exec_prefix@


PREFIX      = @prefix@
MANDIR      = @mandir@
INSTALL     = @INSTALL@
BINDIR      = @bindir@
INSTALL_DIR = ${INSTALL} -m 0755 -d
INSTALL_PROG = ${INSTALL} -s -m 0755 
INSTALL_DATA = ${INSTALL} -m 0644

CC = @CC@
@SET_MAKE@

DEBUG = -g -static -D_DEBUG
INCLUDE = -D_GNU_SOURCE -I. -I./build/include
LIBS = -L./build/lib
CFLAGS = @CFLAGS@ ${DEBUG} ${INCLUDE} ${LIBS}

OBJECTS = password.o \
	  log.o \
	  client.o \
	  time_format.o \
          utility.o \
	  write_self.o \
	  xmpp.o

all: .built-libraries ohai ohaigent owatch owho Makefile

ohai: ohai.o log.o time_format.o utility.o
	${CC} ${CFLAGS} -o ohai ohai.o log.o time_format.o utility.o \
	-levent -lrt

owatch: owatch.o log.o time_format.o utility.o
	${CC} ${CFLAGS} -o owatch owatch.o log.o time_format.o utility.o \
	-levent -lrt

owho: owho.o log.o time_format.o utility.o
	${CC} ${CFLAGS} -o owho owho.o log.o time_format.o utility.o \
	-levent -lrt

ohaigent: ohaigent.o ${OBJECTS}
	${CC} ${CFLAGS} -o ohaigent ohaigent.o ${OBJECTS} \
	-levent -lrt -liksemel -lgnutls -lgcrypt -lgpg-error -ltasn1 -lz

log.o: log.c log.h time_format.h
ohai.o: ohai.c log.h version.h
ohaigent.o: ohaigent.c log.h password.h client.h xmpp.h version.h \
  write_self.h
owatch.o: owatch.c log.h version.h
owho.o: owho.c log.h version.h
password.o: password.c password.h
client.o: client.c log.h write_self.h xmpp.h
time_format.o: time_format.c log.h
utility.o: utility.c utility.h
write_self.o: write_self.c write_self.h log.h
xmpp.o: xmpp.c time_format.h log.h write_self.h xmpp.h

.built-libraries: patch.iksemel-nonblocking
	./build-libraries.sh

clean: 
	rm -f *.o ohai ohaigent owatch owho

distclean: clean
	rm -f Makefile config.h config.log config.status config.cache tags
	rm -Rf autom4te.cache
	rm -Rf build .built-libraries
	rm -Rf iksemel-*
